<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
if( file_exists('stop.php') ) {
	//include_once('stop.php');
}

//
require(dirname(dirname(__FILE__)) . '/includes/application_top.php');

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/content/content.class.php');
$mObj = new ContentBase();
$mObj->format = true;

//
$links = explode(',', $_GET['p']);
$owner = trim(strtolower(util_get_param($_REQUEST, 't')));
if( $owner > 0 ) {
	$mObj->owner = $owner;
}

//
foreach($links as $k => $v) {
	//base
	//$d = array('pages_owner' => '1', 'pages_link' => $v, 'pages_name' => ucfirst($v));
	//$adb->insertA('pp_pages', $d);
	//en_us
	//$d = array('pages_owner' => '1', 'pages_link' => $v, 'pages_name' => ucfirst($v));
	//$adb->insertA('pp_pages', $d);
	//zh_tw
	//$d = array('pages_owner' => '2', 'pages_link' => $v, 'pages_name' => ucfirst($v));
	//$adb->insertA('pp_pages', $d);
	//
	$count = $mObj->getItem($v, 'link');
	if( $count > 0 ) {
		continue;
	}
	$d = array();
	$d['_link'] = $v;
	$d['_name'] = ucfirst($v);
	$d['_subject'] = ucfirst($v);
	
	$mObj->addItem($d);
}

//
echo 'OK';
//
?>